package com.example.springboot.test;

import com.example.springboot.response.CommonResponse;
import com.example.springboot.response.StatisticResponse;
import com.example.springboot.service.EbookSnapshotService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/ebook-snapshot")
public class EbookSnapshotController {

    @Resource
    private EbookSnapshotService ebookSnapshotService;

    @GetMapping("/get-statistic")
    public CommonResponse getStatistic(){
        List<StatisticResponse> statisticResponses = ebookSnapshotService.getStatistic();
        CommonResponse<List<StatisticResponse>> commonResponse = new CommonResponse<>();
        commonResponse.setContent(statisticResponses);
        return commonResponse;
    }

    @GetMapping("/get-30-statistic")
    public CommonResponse get30Statistic() {
        List<StatisticResponse> statisticResponse = ebookSnapshotService.get30Statistic();
        CommonResponse<List<StatisticResponse>> commonResponse = new CommonResponse<>();
        commonResponse.setContent(statisticResponse);
        return commonResponse;
    }


}
